<template>
  <div>
    <Header1></Header1>
    <div class="person">
      <div class="enter-into">
        <div class="entity">
          <h1>
            <span>主体信息</span>
          </h1>
          <div class="info-content">
            <li>
              <div class="info-field">
                <em></em>
                主体类型
              </div>
              <div class="info-type info-value">
                <input type="radio" value="0" class="radio" checked name="type" v-model="selected">
                企业&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input  type="radio" value="1" class="radio radio-other" name="type"  v-model="selected">
                机构&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input  type="radio" value="2" class="radio radio-other" name="type" v-model="selected">
                其他组织
              </div>
            </li>
            <li v-if="showEnterprise">
              <div class="info-field">
                <em></em>
                企业名称
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请与营业执照名称保持一致，审核通过后不可修改</div>
              </div>
            </li>
             <li v-if="showMechanism">
              <div class="info-field">
                <em></em>
                组织机构名称
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请与组织机构代码证或营业执照名称保持一致，审核通过后不可修改</div>
              </div>
            </li>
            <li v-if="showOther">
              <div class="info-field">
                <em></em>
                组织名称
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请确认所填写组织名称的准确性及完整性，审核通过后不可修改</div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                机构所在地
              </div>
              <div class="info-type info-value">
                <select class="select province-select provinceCode">
                  <option value="0">居民身份证</option>
                  <option value="1">军官证</option>
                  <option value="2">护照</option>
                  <option value="3">港澳台通行证</option>
                </select>
                <input type="text" class="text address">
                <div data-v-3feb2bd6 class="tip">请输入详细地址</div>
              </div>
            </li>
            <li v-if="showcode">
              <div class="info-field">
                <em></em>
                组织机构代码
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请与组织机构代码证或营业执照上的组织机构代码保持一致</div>
              </div>
            </li>
            <li v-if="showcord">
              <div class="info-field">
                <em></em>
                组织机构代码证
              </div>
              <div class="info-value info-img certificatePic">
                <span class="img-wrap">
                  <img :src="userInfo.avatar2" alt>
                </span>
                <div class="upload">
                  <span class="info-img-tip">请上传营业执照/组织机构代码证/法人证书扫描件，支持jpg、jpeg、png文件，最大5M</span>
                  <div class="setting_right" @click.stop="uploadHeadImg2">
                    <div class="caption">选择文件</div>
                  </div>
                  <input type="file" accept="image/*" @change="handleFile2" class="hiddenInput2">
                </div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                授权书扫描件
              </div>
              <div class="info-value info-img certificatePic">
                <span class="img-wrap">
                  <img :src="userInfo.avatar1" alt>
                </span>
                <div class="upload">
                  <span class="info-img-tip">请先下载
                    <span class="info-img-tip-em">《讨教号入驻授权书》</span> ，填写后上传加盖公章的扫描件；支持jpg、jpeg、png文件，最大5M
                  </span>
                  <div class="setting_right" @click.stop="uploadHeadImg1">
                    <div class="caption">选择文件</div>
                  </div>
                  <input type="file" accept="image/*" @change="handleFile1" class="hiddenInput1">
                </div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <!-- <em></em> -->
                网站/微博
              </div>
              <div class="info-type info-value">
                <input type="text" class="text" placeholder="可填写您的官方微博或者网址">
              </div>
            </li>
            <!-- <li>
              <div class="info-field">
                <em></em>
                联系邮箱
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请填写本人常用邮箱，此邮箱将用来接收重要通知邮件</div>
              </div>
            </li>-->
          </div>
        </div>
        <div class="tj-info">
          <h1>
            <span>讨教号信息</span>
          </h1>
          <div class="info-content">
            <li>
              <div class="info-field">
                <em></em>
                账号名称
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">2-10个字，请勿使用包含特殊符号或明显营销推广意图的媒体名</div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                账号介绍
              </div>
              <div class="info-type info-value">
                <textarea
                  rows="7"
                  cols="85"
                  maxlength="240"
                  class="textarea"
                  style="margin-top: 0px; margin-bottom: 0px; height: 118px;"
                ></textarea>
                <div class="tip">
                  描述请在10-120字，要求内容完整通顺，无特殊符号和企业信息
                  <em class="word-count">0/120</em>
                </div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                账号头像
              </div>
              <div class="info-value info-img certificatePic">
                <span class="img-wrap">
                  <img :src="userInfo.avatar" alt>
                </span>
                <div class="upload">
                  <span data-v-3feb2bd6 class="info-img-tip">可以上传能证明您专业能力的资料，方便我们评估您的账号，从而获得更多的曝光和推荐</span>
                  <div class="setting_right" @click.stop="uploadHeadImg">
                    <div class="caption">选择文件</div>
                  </div>
                  <input type="file" accept="image/*" @change="handleFile" class="hiddenInput">
                </div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                领域
              </div>
              <div class="info-type info-value">
                <select class="select province-select provinceCode">
                  <option value="0">政府</option>
                  <option value="1">军官证</option>
                  <option value="2">护照</option>
                  <option value="3">港澳台通行证</option>
                </select>
              </div>
            </li>
          </div>
        </div>
        <div class="entity">
          <h1>
            <span>运营者信息</span>
          </h1>
          <div class="info-content">
            <li>
              <div class="info-field">
                <em></em>
                运营者姓名
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请填写有效身份证件上的姓名，一经设置无法修改</div>
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                运营者证件号码
              </div>
              <div class="info-type info-value">
                <select class="select cert-select">
                  <option value="0">居民身份证</option>
                  <option value="1">军官证</option>
                  <option value="2">护照</option>
                  <option value="3">港澳台通行证</option>
                </select>
                <input type="text" class="text cert-code">
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                手机号码
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <!-- <div class="tip">请填写有效身份证件上的姓名，一经设置无法修改</div> -->
              </div>
            </li>
            <li>
              <div class="info-field">
                <em></em>
                联系邮箱
              </div>
              <div class="info-type info-value">
                <input type="text" class="text">
                <div class="tip">请填写本人常用邮箱，此邮箱将用来接收重要通知邮件</div>
              </div>
            </li>
          </div>
        </div>
        <div class="agree">
          <input type="checkbox" class="checkbox" v-model="agree">
          同意
          <span @click="$router.push('/arg')">《讨教号服务协议》</span>
        </div>
        <div class="handle-form">
          <button @click="goback" class="rollback">上一步</button>
          <button :disabled="!agree" :class="toggleSubmit" @click="sumbit">提交</button>
        </div>
      </div>
    </div>
    <Footer></Footer>
  </div>
</template>

<script>
import Header1 from "@/common/Header/Header1";
import Footer from "@/common/Footer/Footer";
export default {
  name: "org",
  data() {
    return {
      //   dialogVisible: false,
      // agreement:
      userInfo: {
        avatar: "",
        avatar1: "",
        avatar2: ""
      },
      selected: 0,
      showEnterprise: true, //显示企业
      showMechanism: false,  //显示机构
      showOther: false,     //显示其他
      showcode:true,
      showcord:true,
      city: true,
      agree: false
    };
  },
  watch: {
    selected(val,oldval) {
      if(val == 0) {
        this.showEnterprise = true;
        this.showcode=true;
        this.showcord=true;
        this.showMechanism = this.showOther = !this.showEnterprise;
      }else if(val == 1) {
        this.showMechanism = true;
        this.showcode=true;
        this.showcord=true;
        this.showEnterprise = this.showOther = !this.showMechanism;
      }else{
        this.showOther = true;
        this.showcode=false;
        this.showcord=false;
        this.showEnterprise = this.showMechanism = !this.showOther;
      }
    }
  },
  methods: {
    sumbit(){
      this.$router.push("/success");
    },
    goback() {
      this.$confirm("您的信息未提交，是否确定离开", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$router.push("/number");
        })
        .catch(() => {});
    },
    // agreementShow() {
    //   this.dialogVisible = true;
    // },
    // clock() {
    //   this.dialogVisible = false;
    // },
    uploadHeadImg: function() {
      console.log(22);
      //  return;
      this.$el.querySelector(".hiddenInput").click();
    },
    uploadHeadImg1: function() {
      console.log(111);
      // return;
      this.$el.querySelector(".hiddenInput1").click();
    },
    uploadHeadImg2: function() {
      console.log(333);
      // return;
      this.$el.querySelector(".hiddenInput2").click();
    },
    // 将头像显示
    handleFile: function(e) {
      let $target = e.target || e.srcElement;
      let file = $target.files[0];
      var reader = new FileReader();
      reader.onload = data => {
        let res = data.target || data.srcElement;
        this.userInfo.avatar = res.result;
      };
      reader.readAsDataURL(file);
    },
    handleFile1: function(e) {
      let $target = e.target || e.srcElement;
      let file = $target.files[0];
      var reader = new FileReader();
      reader.onload = data => {
        let res = data.target || data.srcElement;
        this.userInfo.avatar1 = res.result;
      };
      reader.readAsDataURL(file);
    },
    handleFile2: function(e) {
      let $target = e.target || e.srcElement;
      let file = $target.files[0];
      var reader = new FileReader();
      reader.onload = data => {
        let res = data.target || data.srcElement;
        this.userInfo.avatar2 = res.result;
      };
      reader.readAsDataURL(file);
    }
  },
  computed: {
    toggleSubmit() {
      return {
        "can-submit": this.agree
      };
    }
  },
  components: {
    Header1,
    Footer
  }
};
</script>
<style lang="scss" scoped>
.person {
  background: #fff;
  .enter-into {
    width: 937px;
    margin: 0 auto;

    .entity {
      width: 937px;
      h1 {
        font-size: 20px;
        color: #333;
        border-bottom: 2px solid #e8e8e8;
        position: relative;
        height: 50px;
        span {
          border-bottom: 2px solid #aed6ff;
          position: absolute;
          left: 0px;
          top: 6px;
          padding: 5px 10px;
          line-height: 33px;
        }
      }
      .info-content {
        font-size: 16px;
        padding: 50px 0px 30px;
        margin-left: 106px;
        li {
          margin-bottom: 37px;
          list-style: none;
          display: flex;
          justify-content: flex-start;
          text-align: left;
          .info-field {
            width: 165px;
            height: 40px;
            line-height: 40px;
            em {
              display: inline-block;
              width: 7px;
              height: 7px;
              border-radius: 50%;
              background: #aed6ff;
              margin-right: 14px;
              zoom: 1;
              vertical-align: middle;
            }
          }
          .info-type {
            height: auto;
            line-height: 40px;
          }
          .info-value {
            width: 540px;
            height: auto;
            .radio {
              margin-right: 10px;
              vertical-align: middle;
            }
            .radio-other{
                margin-left: 61px;
            }
            .upload {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
            }
            .setting_right {
              margin-top: 20px;
              height: 37px;
              width: 120px;
              background-color: #e5e5e5;
              font-size: 18px;
              color: #fff;
              border-radius: 5px;
              line-height: 37px;
              text-align: center;
            }
            .hiddenInput1 {
              display: none;
            }
            .hiddenInput2 {
              display: none;
            }
            .text {
              width: 528px;
              height: 40px;
              line-height: 28px;
              padding: 5px;
              border: 1px solid #d0d0d0;
              border-radius: 4px;
              outline: 0px;
            }
            .tip {
              font-size: 12px;
              color: #979797;
              line-height: 20px;
              margin-top: 5px;
              text-align: left;
            }
            .cert-select {
              width: 120px;
            }
            .select {
              padding: 5px;
              height: 40px;
              line-height: 20px;
              margin-right: 7px;
            }
            .cert-code {
              width: 396px;
            }
            option {
              font-weight: normal;
              display: block;
              white-space: pre;
              min-height: 1.2em;
              padding: 0px 2px 1px;
            }
            .province-select {
              width: 160px;
            }
            .city-select {
              width: 160px;
            }
            .address {
              margin-top: 20px;
            }
            .tip-wrong {
              font-size: 12px;
              color: #f81b1b;
              line-height: 20px;
              margin-top: 5px;
            }
          }
          .info-img {
            z-index: 1;
            display: flex;
            justify-content: flex-start;
          }
          .img-wrap {
            display: inline-block;
            width: 120px;
            height: 120px;
            background: #f5f5f5;
            margin-right: 20px;
            overflow: hidden;
            border-radius: 4px;
          }
          .info-img-tip {
            display: inline-block;
            width: 396px;
            font-size: 12px;
            line-height: 20px;
            color: #979797;
            .info-img-tip-em {
              color: #f81b1b;
            }
          }
        }
      }
    }
    .tj-info {
      width: 937px;
      h1 {
        font-size: 20px;
        color: #333;
        border-bottom: 2px solid #e8e8e8;
        position: relative;
        height: 50px;
        span {
          border-bottom: 2px solid #aed6ff;
          position: absolute;
          left: 0px;
          top: 6px;
          padding: 5px 10px;
          line-height: 33px;
        }
      }
      .info-content {
        font-size: 16px;
        padding: 50px 0px 30px;
        margin-left: 106px;
        li {
          margin-bottom: 37px;
          list-style: none;
          display: flex;
          justify-content: flex-start;
          text-align: left;
          .info-field {
            width: 165px;
            height: 40px;
            line-height: 40px;
            em {
              display: inline-block;
              width: 7px;
              height: 7px;
              border-radius: 50%;
              background: #aed6ff;
              margin-right: 14px;
              zoom: 1;
              vertical-align: middle;
            }
          }
          .info-type {
            height: auto;
            line-height: 40px;
          }
          .info-value {
            width: 540px;
            height: auto;
            .upload {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
            }
            .setting_right {
              margin-top: 20px;
              height: 37px;
              width: 120px;
              background-color: #e5e5e5;
              font-size: 18px;
              color: #fff;
              border-radius: 5px;
              line-height: 37px;
              text-align: center;
            }
            .hiddenInput {
              display: none;
            }
            .hiddenInput1 {
              display: none;
            }
            .textarea {
              width: 527px;
              border: 1px solid #d0d0d0;
              padding: 5px;
              line-height: 22px;
              border-radius: 4px;
              max-height: 348px;
              resize: vertical !important;
            }
            .word-count {
              padding-left: 150px;
            }
            .text {
              width: 528px;
              height: 40px;
              line-height: 28px;
              padding: 5px;
              border: 1px solid #d0d0d0;
              border-radius: 4px;
              outline: 0px;
            }
            .tip {
              font-size: 12px;
              color: #979797;
              line-height: 20px;
              margin-top: 5px;
              text-align: left;
            }
            .cert-select {
              width: 120px;
            }
            .select {
              padding: 5px;
              height: 40px;
              line-height: 20px;
              margin-right: 7px;
            }
            .cert-code {
              width: 396px;
            }
            option {
              font-weight: normal;
              display: block;
              white-space: pre;
              min-height: 1.2em;
              padding: 0px 2px 1px;
            }
            .province-select {
              width: 160px;
            }
            .city-select {
              width: 160px;
            }
            .address {
              margin-top: 20px;
            }
            .tip-wrong {
              font-size: 12px;
              color: #f81b1b;
              line-height: 20px;
              margin-top: 5px;
            }
          }
          .info-img {
            z-index: 1;
            display: flex;
            justify-content: flex-start;
          }
          .img-wrap {
            display: inline-block;
            width: 120px;
            height: 120px;
            background: #f5f5f5;
            margin-right: 20px;
            overflow: hidden;
            border-radius: 4px;
          }
          .info-img-tip {
            display: inline-block;
            width: 396px;
            font-size: 12px;
            line-height: 20px;
            color: #979797;
            .info-img-tip-em {
              color: #f81b1b;
            }
          }
        }
      }
    }
    .agree {
      text-align: left;
      margin-bottom: 10px;
      margin-left: 165px;
      height: 40px;
      .checkbox {
        margin-right: 5px;
        vertical-align: middle;
      }
      span {
        color: #fd5900;
      }
    }
    .handle-form {
      margin-left: 165px;
      width: 540px;
      padding-bottom: 30px;

      // position: relative;
      display: flex;
      justify-content: flex-start;
      .rollback {
        cursor: pointer;
        color: #666;
      }
      button {
        color: #fff;
        margin-right: 10px;
        border-radius: 4px;
        width: 130px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        outline: none;
        border: 0;
      }
      .can-submit {
        background-color: #fd5900;
        cursor: pointer;
      }
    }
    .win-mask {
      background: rgba(0, 0, 0, 0.5);
      width: 100%;
      height: 100%;
      position: absolute;
      z-index: 10;
      top: 0;
      transition: opacity 0.25s;
      text-align: left;
      .info-dialog {
        width: 720px;
        height: 710px;
        margin-left: -327.5px;
        border: 1px solid #f1f1f1;
        padding: 0px 52.5px;
        position: absolute;
        left: 50%;
        bottom: 350px;
        // transform: translateY(-50%);
        z-index: 1050;
        background-color: #fff;
        box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.2);
        border-radius: 10px;
        .info-title {
          height: 65px;
          border-bottom: 2px solid #eaeaea;
          font-size: 18px;
          line-height: 65px;
          text-align: center;
          .qrcode-close {
            position: absolute;
            top: 15px;
            right: 25px;
            font-size: 28px;
            line-height: 30px;
            font-weight: 400;
            color: #999;
            text-decoration: none;
            display: block;
          }
        }
        .main-info {
          .first-info {
            margin-top: 35px;
          }
          p {
            margin: 0;
            line-height: 2;
          }
        }
      }
    }
  }
}
</style>


